﻿using EcoTourEduca.BingYourMaps.Models;
using EcoTourEduca.BingYourMaps.ViewModels;
using Orchard;
using Orchard.ContentManagement;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace EcoTourEduca.BingYourMaps.Services
{
    public interface IBingYourMapsService : IDependency
    {
        /// <summary>
        /// Returns string setting for the default BingMap type.
        /// </summary>
        string DefaultMapType { get; }

        /// <summary>
        /// Returns SelectList with selectable BingMaps types.
        /// </summary>
        /// <param name="mapType"></param>
        /// <returns></returns>
        SelectList CreateMapTypeList(string mapType);

        /// <summary>
        /// Given a location and a ViewModel, updates all BingMapsAreas to reflect the addition of the new BingMapsLocation
        /// </summary>
        /// <param name="bingMapsLocationPart"></param>
        /// <param name="viewModel"></param>
        void UpdateBingMapAreas(BingMapsLocationPart bingMapsLocationPart, EditBingMapsLocationViewModel viewModel);

        /// <summary>
        /// Given a BingMapsArea part reference, it removes all area-location mappings existing for that area.
        /// </summary>
        /// <param name="areaPart"></param>
        void RemoveMappingsForBingMapsArea(BingMapsAreaPart areaPart);

        /// <summary>
        /// Given a BingMapsLocation part reference, it removes all area-location mappings existing for that location.
        /// </summary>
        /// <param name="areaPart"></param>
        void RemoveMappingsForBingMapsLocation(BingMapsLocationPart locationPart);

        /// <summary>
        /// Returns the Title for a given an IContent item
        /// </summary>
        /// <param name="content"></param>
        /// <param name="defaultTitle"></param>
        /// <returns></returns>
        string GetTitle(IContent content, string defaultTitle);

        /// <summary>
        /// Given the part id, returns the corresponding BingMapsAreaPart of null if the id doesn't exist
        /// </summary>
        /// <param name="bingMapsAreaPartId"></param>
        /// <returns></returns>
        BingMapsAreaPart GetBingMapsAreaByPartId(int bingMapsAreaPartId);

        /// <summary>
        /// Returns the corresponding BingMapsAreaPart for the given BingMapsArea record or null if souch
        /// part does not exist
        /// </summary>
        /// <param name="bingMapsAreaRecordId"></param>
        /// <returns></returns>
        BingMapsAreaPart GetBingMapsAreaByRecordId(int bingMapsAreaRecordId);

        /// <summary>
        /// Given the part id, returns the corresponding BingMapsLocationPart of null if the id doesn't exist
        /// </summary>
        /// <param name="bingMapsAreaPartId"></param>
        /// <returns></returns>
        BingMapsLocationPart GetBingMapsLocationByPartId(int bingMapsLocationPartId);

        /// <summary>
        /// Returns the corresponding BingMapsLocationPart for the given BingMapsLocation record or null if souch
        /// part does not exist
        /// </summary>
        /// <param name="bingMapsAreRecordId"></param>
        /// <returns></returns>
        BingMapsLocationPart GetBingMapsLocationByRecordId(int bingMapsLocationRecordId);

        /// <summary>
        /// Returns the collection of all BingMapsArea.
        /// </summary>
        IEnumerable<BingMapsAreaViewModel> GetAllBingMapsAreas();

        /// <summary>
        /// Returns the collection of all BingMapsArea containing the given BingMapsLocation.
        /// </summary>
        IEnumerable<BingMapsAreaViewModel> GetBingMapsAreasForLocationPart(int bingMapsLocationPartId);

        /// <summary>
        /// Returns the collection of all BingMapAreas that contain the given BingMapsLocation.
        /// </summary>
        /// <param name="bingMapsLocationPartId"></param>
        /// <returns></returns>
        IEnumerable<BingMapsAreaPart> GetBingMapsAreaPartsForLocationPart(int bingMapsLocationPartId);

        /// <summary>
        /// Returns the collection of all BingMapsLocation contained in the given BingMapsArea.
        /// </summary>
        /// <param name="bingMapsAreaPartId"></param>
        /// <returns></returns>
        IEnumerable<BingMapsLocationPart> GetBingMapsLocationPartsForAreaPart(int bingMapsAreaPartId);

        /// <summary>
        /// Returns true if there's a mapping between the given location and area records.
        /// </summary>
        /// <param name="locationRecord"></param>
        /// <param name="areaRecord"></param>
        /// <returns></returns>
        bool IsLocationMappedToArea(BingMapsLocationRecord locationRecord, BingMapsAreaRecord areaRecord);
        
        /// <summary>
        /// Returns true if there's a mapping between the given location and area parts.
        /// </summary>
        /// <param name="locationRecord"></param>
        /// <param name="areaRecord"></param>
        /// <returns></returns>
        bool IsLocationMappedToArea(BingMapsLocationPart locationPart, BingMapsAreaPart areaPart);

        /// <summary>
        /// Returns true if there's a mapping between the given location record and area part.
        /// </summary>
        /// <param name="locationRecord"></param>
        /// <param name="areaRecord"></param>
        /// <returns></returns>
        bool IsLocationMappedToArea(BingMapsLocationRecord locationRecord, BingMapsAreaPart areaPart);

        /// <summary>
        /// Returns true if there's a mapping between the given location part and area record.
        /// </summary>
        /// <param name="locationRecord"></param>
        /// <param name="areaRecord"></param>
        /// <returns></returns>
        bool IsLocationMappedToArea(BingMapsLocationPart locationPart, BingMapsAreaRecord areaRecord);

        /// <summary>
        /// Returns true if the BingMapsAreaPart matching the given id exists
        /// </summary>
        /// <param name="areaPartId"></param>
        /// <returns></returns>
        bool ExistsBingMapsAreaPart(int areaPartId);

        /// <summary>
        /// Returns true if the BingMapsLocationPart matching the given id exists
        /// </summary>
        /// <param name="locationPartId"></param>
        /// <returns></returns>
        bool ExistsBingMapsLocationPart(int locationPartId);
    }
}
